<?php
  	require_once('MysqlConnect.php');
	$username=$_POST['username'];
	if(!$username) {
		echo "<script>alert('注册失败，账号不能为空');window.location.href='MainPage_Create.php'</script>";
		exit();
	}

	$password=$_POST['password'];
	if(!$password) {
		echo "<script>alert('注册失败，密码不能为空');window.location.href='MainPage_Create.php'</script>"; 
		exit();
	}

	$password1=$_POST['password1'];
	if($password1!=$password) {
		echo "<script>alert('注册失败，两次输入的密码不一样');window.location.href='MainPage_Create.php'</script>";
		exit();
	}
	$ins="Insert userlist (username,password) values('$username','$password')";
	if(mysql_query($ins)) echo "<script>alert('注册成功');window.location.href='MainPage.php'</script>";
	else echo "<script>alert('注册失败，账号已被注册');window.location.href='MainPage_Create.php'</script>";
?>